import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { WorkpostService } from './workpost.service';
import { CreateWorkpostDto } from './dto/create-workpost.dto';
import { UpdateWorkpostDto } from './dto/update-workpost.dto';
import { SearchWorkPostDto } from './dto/search-workpost.dto';

@Controller('workpost')
export class WorkpostController {
  constructor(private readonly workpostService: WorkpostService) { }

  @Post()
  create(@Body() createWorkpostDto: CreateWorkpostDto) {
    return this.workpostService.create(createWorkpostDto);
  }

  @Get()
  findSearch(@Query() searchWorkPostDto: SearchWorkPostDto) {
    return this.workpostService.findSearch(searchWorkPostDto);
  }

  @Get('all')
  findAll() {
    return this.workpostService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.workpostService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateWorkpostDto: UpdateWorkpostDto) {
    return this.workpostService.update(+id, updateWorkpostDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.workpostService.remove(+id);
  }
}
